package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.service.IUserService;
import org.I0Itec.zkclient.ZkClient;

/**
 * @author 13771
 * @date 2020/8/31 13:52
 * @description
 */
public class ConsumerBoot {
    //参数定义
    //private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static ZkClient zkClient = new ZkClient("127.0.0.1:2181");

    public static void main(String[] args) throws InterruptedException {

//        new Thread(new ZkConfig()).start();
        //1.创建代理对象,强转成IUserService
        IUserService service = (IUserService) RPCConsumer.creatProxy(IUserService.class);

        //2.循环给服务器写数据
        while (true){
            String result = service.sayHello("hello world!");
            System.out.println(result);
            Thread.sleep(1000);
        }
    }
}
